package com.xiaotu.code.system;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 普通任务包装类.
 * 
 * 供非同步任务使用，见com.iris.scm.system.task.BaseTask
 * 
 * @author chenxiangrong
 * 
 */
public class SimpleTaskWrap implements Serializable, Runnable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -883381570413912907L;
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	private BaseTask task;

	public SimpleTaskWrap(BaseTask task) {
		super();
		this.task = task;
	}

	@Override
	public void run() {
		try {
			logger.info(String.format("SimpleTaskWrap task:进入%s执行", task.getTaskName()));
			task.run();
			logger.info(String.format("SimpleTaskWrap task:%s执行完毕", task.getTaskName()));
		} catch (Exception e) {
			logger.error(String.format("SimpleTaskWrap运行任务%s错误", task.getTaskName()), e);
		}
	}

}
